package com.example.example04;

import java.io.IOException;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

public class RawLogTextMapper extends Mapper<LongWritable,Text,Text,Text>{
  Text key = new Text();
  @Override
  public void map(LongWritable offset,Text lineText,Context context) throws IOException, InterruptedException{
    String lineStr = lineText.toString();
    if(lineStr==null || lineStr.length() < 1)
      return;
    String[] fields = lineStr.split("\\t");
    key.set(fields[2].split("_")[0]);
    context.write(key, lineText);
  }
}
